#include <iostream>
#include <vector>
using namespace std;
int n, q;
const int N = 1e5 + 10;
vector<int> a[N];

int main()
{
    cin >> n >> q;
    while(q--)
    {
        int op;
        cin >> op;
        if(op == 1)
        {
            // 存放
            int i, j, k;
            cin >> i >> j >> k;
            if(a[i].size() <= j)
            {
                // 扩容
                a[i].resize(j + 1);
            }
            a[i][j] = k;
        }
        else
        {
            // 查询
            int i, j;
            cin >> i >> j;
            cout << a[i][j] << endl;
        }
    }
    return 0;
}